<%@ Page Language="C#" Theme="Defaultsys" AutoEventWireup="true" CodeFile="UserList.aspx.cs"
    Inherits="Users" Title="Rapport Plan System - User list" MasterPageFile="~/MasterPage.master" %>

<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1">
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
        <tr>
            <td class="contTable">
                <asp:GridView ID="gvUsers" runat="server" DataKeyNames="UserId" AutoGenerateColumns="False"
                    CellPadding="0" CellSpacing="0" Width="100%" SkinID="gvGrid" AllowPaging="True"
                    AllowSorting="True" PageSize="20" OnRowCommand="gvUsers_RowCommand" OnRowDataBound="RowDataBound"
                    OnPageIndexChanging="gvUsers_PageIndexChanging">
                    <Columns>
                        <asp:TemplateField HeaderText="ID" 
                            HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="3%">
                            <ItemTemplate>
                                <%# Container.DataItemIndex + 1 %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="Full Name">
                            <ItemTemplate>
                                <asp:Label Width="150" ID="Label1" runat="server" Text='<%# String.Format("{0} {1}", Eval("FirstName"),  Eval("LastName")) %>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Left" />
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        
                        <asp:BoundField DataField="ConnectName" HeaderText="Connect Name">
                            <ItemStyle HorizontalAlign="Left" />
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:BoundField>
                        
                        <asp:TemplateField HeaderText="Edit" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Button ID="btnEdit" runat="server" CommandName="edit" Text="Edit" CommandArgument='<%# Eval("UserId") %>' />
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Button ID="btnRemove" runat="server" CommandName="delete" Text="Delete" CommandArgument='<%# Eval("UserId") %>' />
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle CssClass="grid_header" />
                    <RowStyle CssClass="grid_row" />
                    <AlternatingRowStyle CssClass="grid_altrow" />
                    <EmptyDataTemplate>
                        There are currently no users.</EmptyDataTemplate>
                    <PagerStyle VerticalAlign="Middle" HorizontalAlign="Left" Wrap="False" CssClass="paging"
                        Font-Bold="True"></PagerStyle>
                    <PagerSettings Mode="NumericFirstLast" />
                </asp:GridView>
                <br />
                <asp:Button ID="btnAddNewUser" runat="server" Text="Add new user" OnClick="AddNewUser" />
            </td>
        </tr>
    </table>
</asp:Content>
